package com.itheima.dao;

import com.github.pagehelper.Page;
import com.itheima.common.entity.QueryPageBean;
import com.itheima.pojo.CheckItem;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @author 32338
 * @date 2024-05-02 15:51:33
 * @description 检查项数据层
 */
@Mapper
public interface CheckItemDao {

    /**
     * @description
     ***:新增检查项
     **/
    @Insert("insert into t_checkitem(code, name, sex, age, price, type, attention, remark)\n" +
            "VALUES (#{code},#{name},#{sex},#{age},#{price},#{type},#{attention},#{remark})\n")
    void save(CheckItem checkItem);

    /**
     * @description
     ***:删除检查项
     **/
    @Delete("delete from t_checkitem where id = #{id}")
    void delete(Integer id);

    /**
     * @description
     ***:修改回显检查项
     **/

    CheckItem findById(Integer id);

    /**
     * @description
     ***:修改检查项
     **/
    void updateCheckItem(CheckItem checkItem);

    /**
     * @description
     ***:分页查询
     **/
    Page<CheckItem> page(String value);

    /**
     * @description
     ***:根据检查组id查询关联的检查项id
     **/
    List<Integer> findCheckItemIdsByCheckGroupId(Integer checkGroupId);

    /**
     * @description
     ***:查询所有检查项
     **/
    @Select("select * from t_checkitem")
    List<CheckItem> findAll();

    Page<CheckItem> findByCondition(String value);
}
